package com.itheima.filter;

import jakarta.servlet.*;
import jakarta.servlet.annotation.WebFilter;

import java.io.IOException;

@WebFilter("/*")
public class DemoFilter implements Filter {

    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        Filter.super.init(filterConfig);
        System.out.println("init........");
    }

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        System.out.println("执行了doFilter"+ servletRequest);
        //放行 继续执行下一个过滤器
        filterChain.doFilter(servletRequest,servletResponse);
        System.out.println("controller执行");
    }


    @Override
    public void destroy() {
        System.out.println("destory........");
    }
}
